package cn.zktr.Personnel.common;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class DateListString {
	
	/**年月日 时分秒 2019-01-01 00:00:00
	 * @param data
	 * @return
	 */
	public List<String> getDateListString(String date) {
		try {
			List<String> list = new ArrayList<>();
		    Calendar aCalendar  = Calendar.getInstance();
		    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-M-d H:m:s");
		    Date dates = dateFormat.parse(date);
		    aCalendar.setTime(dates);
		    int year = aCalendar.get(Calendar.YEAR);
		    int month = aCalendar.get(Calendar.MONTH) + 1;
		    int day = aCalendar.getActualMaximum(Calendar.DATE);
		    String monthStr="0";
		    if(month<10){
		        monthStr="0"+month;
		    }else{
		        monthStr=String.valueOf(month);
		    }
		    for (int i = 1; i <= day; i++) {
		        String days="0";
		        if(i<10){
		            days="0"+i;
		        }else {
		            days=String.valueOf(i);
		        }
		        list.add(String.valueOf(year)+"-"+monthStr+"-"+days);
		    }
		    return list;
		} catch (ParseException e) {
			return null;
		}
	}

}
